package com.dnjn.mes.biz.assist;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class ScheduleAssist {
    @Autowired
    private RecordTaskHandler recordTaskHandler;

    @Scheduled(cron = "0 0/1 * * * ? ")
    public void handleStatusTask() {
        log.info("---- start status schedule---------------------------------");
        try {
            recordTaskHandler.handleStatus();
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }

    @Scheduled(cron = "0 0/1 * * * ? ")
    public void handleExceptTask() {
        log.info("---- start except schedule---------------------------------");
        try {
            recordTaskHandler.handleExcept();
            //recordTaskHandler.handleBeat();
            //recordTaskHandler.handleCapacity();

        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }

}
